function qxjyOption(data, legendName = "") {
  if (data.length < 1) {
    return {};
  }
  let xData = [];
  let seriesData = [];
  data.forEach((element) => {
    xData.push(element.label);
    seriesData.push(element.value);
  });

  const option = {
    legend: {
      data: [legendName],
      textStyle: {
        color: "#fff",
      },
    },
    tooltip: {
      trigger: "axis",
    },
    grid: {
      top: "20%",
      bottom: "12%",
    },
    xAxis: {
      type: "category",
      axisLabel: {
        color: "#fff",
      },
      data: xData,
    },
    yAxis: {
      name: "单位 :  mm",
      nameTextStyle: {
        color: "rgba(255,255,255,0.8)",
      },
      splitLine: {
        lineStyle: {
          type: "dashed",
        },
      },
      axisLabel: {
        color: "#fff",
      },
      type: "value",
    },
    series: [
      {
        name: legendName,
        data: seriesData,
        type: "line",
        barWidth: 25,
        color: "rgb(215, 226, 54)",
        symbolSize: 8,
        areaStyle: {
          opacity: 0.3,
        },
      },
    ],
  };
  return option;
}

export default qxjyOption;
